#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

int Hermite(int n,int x)
{
	if (n == 0)
	{
		return 1;
	}
	else if (n == 1)
	{
		return 2 * n;
	}
	else if(n>=1)
	{
		return 2 * x * Hermite(n - 1, x) - 2 * (n - 1) * Hermite(n - 2, x);
	}
}

int main()
{

	int n; int x;
	while (scanf("%d %d",&n,&x) != EOF)
	{
		int answer = Hermite(n, x);
		printf("%d\n", answer);
	}

	return 0;

}